package img.info;

import java.util.Iterator;
import java.util.List;

import pojos.ImageData;

/**
 * Store information about Omero images
 * 
 * @author Peter Kuijpers
 *
 */
public class OmeroImage  extends SampleImage {
	/** id of image in omero */
	private long omeroImageId;
	
	/** file name of sorted_frm_list */
	private String sortedFrmList;
	
	/** filename of sorted_match_list */
	private String sortedMatchList;

	/**
	 * Constructor for an Omero Image 
	 */
	public OmeroImage() {
	}
	
	/**
	 * Set the omero imageid
	 * @param id
	 */
	public void setOmeroImageId( long id ) {
		omeroImageId = id;
	}
	/**
	 * Get the omero imageId
	 * @return
	 */
	public long getOmeroImageId( ) {
		return omeroImageId;
	}
	
	/**
	 * Match the imageName of the current instance with the list of images. <br/>
	 * When a match is found the omeroImageId is stored as omeroImageId to the instance
	 * 
	 * @param omeroImages
	 */
	public void matchNameWithOmeroData( List<ImageData> omeroImages ) {
		Iterator<ImageData> j = omeroImages.iterator();
		ImageData imageData = new ImageData();
		boolean found = false;
		while (j.hasNext()  && ! found )  {
			imageData = j.next();
			if ( imageData.getName().equals( imageName ) ) {
				found = true;
				omeroImageId =  imageData.getId();
			}
		}
	}
	
	public void setSortedFrmList( String sortedFrmList ) {
		this.sortedFrmList = sortedFrmList;
	}
	
	public String getSortedFrmList( ) {
		return sortedFrmList;
	}
	public void setSortedMatchList( String sortedMatchList ) {
		this.sortedMatchList = sortedMatchList;
	}
	
	public String getSortedMatchList() {
		return sortedMatchList;
	}
	
}
